Skip to content

HDDS-15209. Stabilize TestRocksDBCheckpointDiffer#testDifferWithDB for RocksDB layout variance - #10890

Closed
jojochuang wants to merge 2 commits into
apache:masterfrom
jojochuang:HDDS-15209
Closed

jojochuang wants to merge 2 commits into
apache:masterfrom
jojochuang:HDDS-15209

Conversation

@jojochuang

Copy link
Copy Markdown
Contributor

Summary

Revives HDDS-15209 / replaces conflicted head on #10363 with a branch merged to current master.

  • Stabilizes TestRocksDBCheckpointDiffer#testDifferWithDB (no @Flaky, wait for in-flight compactions, independent metadata diff oracle, DAG subset checks, SST backup assertions).
  • Based on current master (includes prior partial HDDS-15209 hardening on backup link checks).

Jira

https://issues.apache.org/jira/browse/HDDS-15209

Test plan

  • mvn -pl :rocksdb-checkpoint-differ test -Dtest=TestRocksDBCheckpointDiffer
  • ./hadoop-ozone/dev-support/checks/pmd.sh

Supersedes conflict resolution for #10363 (head still on outdated arunsarin85:HDDS-15209).

Made with Cursor

jojochuang and others added 2 commits July 28, 2026 12:32
Wait for in-flight compactions before diff assertions. Validate snapshot
metadata diffs independently, verify DAG subset filtering against the full
DAG diff, fail fast when getSSTDiffList returns empty Optional, and assert
SST backups using first-to-last diff vs snapshot/backup dir (per review).
Remove @flaky.

Co-authored-by: Cursor <cursoragent@cursor.com>
Change-Id: Icb1b4f87c93d317a860c10d64a35c62227ce5101
Co-authored-by: Cursor <cursoragent@cursor.com>
Change-Id: I42a3c7da8f0c1872d860f88fba3456c1175b79c8

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Stabilizes TestRocksDBCheckpointDiffer#testDifferWithDB in the rocksdb-checkpoint-differ module by reducing dependence on RocksDB’s non-deterministic SST numbering/compaction shape and by adding stronger synchronization and derived “oracle” checks.

Changes:

  • Removes the @Flaky marker and waits for in-flight compactions to drain before DAG-based assertions.
  • Reworks snapshot diff verification to (a) validate non-DAG diffs against an independently computed snapshot-metadata diff and (b) validate subset DAG diffs against a “full tables” DAG diff baseline.
  • Replaces the prior fixed backup-link expectations with a new helper assertion around SST backup contents.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +1132 to +1138
Set<String> backupBaseNames;
try (Stream<Path> sstPathStream = Files.list(sstBackUpDir.toPath())) {
backupBaseNames = sstPathStream.map(path -> getBaseName(path.getFileName().toString()))
.collect(Collectors.toSet());
assertThat(backupBaseNames).isNotEmpty();
assertThat(backupBaseNames).allMatch(name -> name.matches("\\d+"));
}

@arunsarin85 arunsarin85 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 LGTM.
Thanks for addressing the review comments and rebasing on current master.

Closing my stale #10363 in favor of this PR for merge.

new DifferSnapshotVersion(src, 0, allTables),
new DifferSnapshotVersion(snap, 0, allTables),
null, allTables, false).orElse(Collections.emptyList());
assertThat(metadataDiffViaApi).containsExactlyInAnyOrderElementsOf(metadataDiff);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this oracle independent of the code under test? buildNonDagMetadataDiff (L1089) does the symmetric diff of getSstFiles(0, tables), and the useCompactionDag=false branch it's checked against (getSSTDiffList, main L830-846) does the same diff over the same getSstFiles(0, tables) with the same SstFileInfo.equals — so both sides move together and a matching bug still passes. It also never exercises the compaction DAG. Diff against an independent source, or drop it and rely on the DAG-path checks?

Comment on lines +1136 to +1141
assertThat(backupBaseNames).isNotEmpty();
assertThat(backupBaseNames).allMatch(name -> name.matches("\\d+"));
}
for (SstFileInfo diffFile : diffSinceFirst) {
String fileName = diffFile.getFileName();
assertTrue(lastSnapshotFileNames.contains(fileName) || backupBaseNames.contains(fileName),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Weaker than what it replaces (master: exactly 7 links, \d{6}\.sst). Relaxing \d{6}→\d+ is fair (SST number width varies), but isNotEmpty drops the count, and lastSnapshotFileNames.contains(f) || backupBaseNames.contains(f) is met by the last-snapshot branch alone — it'd pass even if the backup dir were near-empty. Keep a lower-bound count and assert the backup dir actually holds the DAG-diff SSTs?

@rich7420 rich7420 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jojochuang thanks for the patch

@github-actions

Copy link
Copy Markdown

This PR has been marked as stale due to 21 days of inactivity. Please comment or remove the stale label to keep it open. Otherwise, it will be automatically closed in 7 days.

@github-actions github-actions Bot added the stale label Aug 30, 2026
@github-actions

github-actions Bot commented Sep 7, 2026

Copy link
Copy Markdown

Thank you for your contribution. This PR is being closed due to inactivity. Please contact a maintainer if you would like to reopen it.

@github-actions github-actions Bot closed this Sep 7, 2026
arunsarin85 added a commit to arunsarin85/ozone that referenced this pull request Sep 24, 2026
Wait for in-flight compactions before diff assertions, fail fast when
getSSTDiffList returns empty Optional, verify DAG subset filtering against
the full-table DAG diff, and assert SST backups hold compacted-away files.
Remove @flaky.

Revives apache#10890 on current master, addressing review feedback
to keep the independent self-diff oracle and strengthen backup assertions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants